package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduHouseDetail.EduHouseDetailKeyVO;
import com.jwsoft.manager.common.vo.eduHouseDetail.EduHouseDetailQueryVO;
import com.jwsoft.manager.common.vo.eduHouseDetail.EduHouseDetailSearchVO;
import com.jwsoft.manager.common.vo.eduHouseDetail.EduHouseDetailVO;
import com.jwsoft.manager.core.integration.EduHouseDetailIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 房产信息表网关
 *
 * @author wangtao
 * @since 2022-12-01
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "房产信息表", description = "房产信息表")
public class EduHouseDetailController {

    @Autowired
    public EduHouseDetailIntegration eduHouseDetailIntegration;

    @Operation(summary = "房产信息表分页查询",description = "房产信息表分页查询")
    @PostMapping(value = "/eduHouseDetail0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseDetailVO>> getList(@RequestBody @Validated EduHouseDetailQueryVO vo) {
        return AppResponse.successData(eduHouseDetailIntegration.getList(vo));
    }

    @Operation(summary = "房产信息表根据主键查询详情",description = "房产信息表根据主键查询详情")
    @PostMapping(value = "/eduHouseDetail0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseDetailVO> getById(@RequestBody @Validated EduHouseDetailKeyVO vo) {
        return AppResponse.successData(eduHouseDetailIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息表新增",description = "房产信息表新增")
    @PostMapping(value = "/eduHouseDetail0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseDetailVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduHouseDetailVO vo) {
        return AppResponse.successData(eduHouseDetailIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息表修改",description = "房产信息表修改")
    @PostMapping(value = "/eduHouseDetail0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseDetailVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduHouseDetailVO vo) {
        return AppResponse.successData(eduHouseDetailIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产信息表删除",description = "房产信息表删除")
    @PostMapping(value = "/eduHouseDetail0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduHouseDetailKeyVO vo) {
        eduHouseDetailIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "不动产权号查询", description = "不动产权号查询")
    @PostMapping(value = "/eduHouseDetail0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseDetailVO>> queryHouseId(@RequestBody @Validated EduHouseDetailSearchVO vo) {
        return AppResponse.successData(eduHouseDetailIntegration.queryHouseId(vo));
    }
}
